package com.czy.owner.api;

import com.czy.owner.db.UserHelper;
import com.czy.owner.global.Constants;
import com.czy.owner.net.api.BaseApi;
import com.czy.owner.net.listener.HttpOnNextListener;
import com.trello.rxlifecycle.components.support.RxAppCompatActivity;

import java.util.HashMap;

import retrofit2.Retrofit;
import rx.Observable;

/**
 * Created by King on 2017-06-06
 */

public class GetInsurancesApi extends BaseApi {
    public GetInsurancesApi(HttpOnNextListener listener, RxAppCompatActivity rxAppCompatActivity) {
        super(listener, rxAppCompatActivity);
        setCache(true);
        setMothed(UserHelper.getInstance().getUserAccount() + Constants.OWN_INSURANCES);//相当于缓存保存的Key
        setCookieNetWorkTime(3600);//有网缓存0s,在0s内点击无效
        setCookieNoNetWorkTime(3600 * 24);//无网缓存0天
        setShowProgress(true);
    }
    @Override
    public Observable getObservable(Retrofit retrofit) {
        return retrofit.create(HttpPostService.class).GetInsurances();
    }
}
